package jnpf.util;

import cn.hutool.core.collection.CollectionUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: duanxu
 * @create: 2025-02-14 09:56
 **/
public class OrganizeUtil {

    /**
     * 组织机构id集合转换组织结构名称集合逗号隔开字符串
     *
     * @param organizeIds
     * @param organizeMap
     * @return
     */
    public static String organizeIdsToString(List<String> organizeIds, Map<String, String> organizeMap) {
        if (CollectionUtil.isEmpty(organizeIds)) {
            return null;
        }
        List<String> organizeList = new ArrayList<>();
        for (String organizeId : organizeIds) {
            if (organizeMap.containsKey(organizeId)) {
                organizeList.add(organizeMap.get(organizeId));
            }
        }
        return organizeList.isEmpty() ? null : String.join(",", organizeList);
    }

}
